Electronic devices, such as computer systems, typically communicate with audio devices through device drivers associated with the audio devices. For example, a computer system plays sound on a speaker by sending audio information to a device driver designed for the speaker. Similarly, a computer system captures audio information from a microphone by receiving audio data from the device driver associated with the microphone.
Various approaches may be used to handle the communication of audio information between client applications (“clients”) that use audio information and the device drivers of audio devices. For example, according to an interrupt-based approach, a direct connection is established between the driver and its client application. Any time the driver wants audio data from the client, the driver raises an interrupt, suspending other activity on the Central Processing Unit (“CPU”) of the computer system on which the client is running. Therefore, for a certain period of time, the driver is in control of the computer system.
To avoid problems associated with the interrupt approach, a “ring buffer” approach has been developed. According to the ring buffer approach, execution of a device driver is decoupled from execution of its client application by using a ring buffer as a rendezvous point for communicating audio data between the device driver and the client application. Specifically, the device driver for a playback device reads audio data from the ring buffer without directly communicating with the client application. The client application, in turn, feeds audio data into the ring buffer ahead of the device driver so that the device driver continues to have new to read. Similarly, the device driver for a recording device writes audio data into the ring buffer without directly communicating with the client application. The client application, in turn, reads audio data from the ring buffer at a rate to ensure that the device driver does not overwrite unread audio data.
As audio systems become more sophisticated, the type and number of audio devices used by a system has increased. Consequently, there is a need to be able to send audio to multiple playback devices connected to a system in a manner that results in synchronized playback by the multiple devices. Similarly, there is a need to be able to consume audio from multiple audio sources connected to a system, to allow a single client application to concurrently consume audio from the various audio sources.